package com.hilatest.wsexample.basictest;

import java.util.Random;

import javax.xml.ws.Endpoint;

public class BasicPublish {

	public static final String URL="http://127.0.0.1:%1$s/ts";
	
	
	/**
	 * generate URL
	 */
	public String getURL(int port){
		String result = String.format(URL, port);
		return result;
	}
	
	
	public void publish(Object SIB){
		final Random r = new Random();
		int port = 5000+r.nextInt(10000);

		this.publish(SIB, port);
	}
	
	public void publish(Object SIB,int port){
		System.out.println("server start:");
		
		String url = this.getURL(port);
		
		System.out.println("WSDL:");
		System.out.println(url+"?wsdl");
		System.out.println("server:");
		System.out.println(url);
		Endpoint.publish(url, SIB);
	}
}
